package com.klw.business.service.impl;

import java.util.List;

import com.klw.business.domain.KlmBatchModel;
import com.klw.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.klw.business.mapper.KlwStudentAttendanceMapper;
import com.klw.business.domain.KlwStudentAttendance;
import com.klw.business.service.IKlwStudentAttendanceService;

/**
 * 学生出勤记录Service业务层处理
 * 
 * @author klw
 * @date 2025-08-24
 */
@Service
public class KlwStudentAttendanceServiceImpl implements IKlwStudentAttendanceService 
{
    @Autowired
    private KlwStudentAttendanceMapper klwStudentAttendanceMapper;

    /**
     * 查询学生出勤记录
     * 
     * @param attendanceId 学生出勤记录主键
     * @return 学生出勤记录
     */
    @Override
    public KlwStudentAttendance selectKlwStudentAttendanceByAttendanceId(Long attendanceId)
    {
        return klwStudentAttendanceMapper.selectKlwStudentAttendanceByAttendanceId(attendanceId);
    }

    /**
     * 查询学生出勤记录列表
     * 
     * @param klwStudentAttendance 学生出勤记录
     * @return 学生出勤记录
     */
    @Override
    public List<KlwStudentAttendance> selectKlwStudentAttendanceList(KlwStudentAttendance klwStudentAttendance)
    {
        return klwStudentAttendanceMapper.selectKlwStudentAttendanceList(klwStudentAttendance);
    }

    /**
     * 新增学生出勤记录
     * 
     * @param klwStudentAttendance 学生出勤记录
     * @return 结果
     */
    @Override
    public int insertKlwStudentAttendance(KlwStudentAttendance klwStudentAttendance)
    {
        klwStudentAttendance.setCreateTime(DateUtils.getNowDate());
        return klwStudentAttendanceMapper.insertKlwStudentAttendance(klwStudentAttendance);
    }

    /**
     * 修改学生出勤记录
     * 
     * @param klwStudentAttendance 学生出勤记录
     * @return 结果
     */
    @Override
    public int updateKlwStudentAttendance(KlwStudentAttendance klwStudentAttendance)
    {
        klwStudentAttendance.setUpdateTime(DateUtils.getNowDate());
        return klwStudentAttendanceMapper.updateKlwStudentAttendance(klwStudentAttendance);
    }

    /**
     * 批量删除学生出勤记录
     * 
     * @param attendanceIds 需要删除的学生出勤记录主键
     * @return 结果
     */
    @Override
    public int deleteKlwStudentAttendanceByAttendanceIds(Long[] attendanceIds)
    {
        return klwStudentAttendanceMapper.deleteKlwStudentAttendanceByAttendanceIds(attendanceIds);
    }

    @Override
    public int deleteKlwStudentAttendancByAttendanceId(Long attendanceId) {
        return 0;
    }

    /**
     * 获取学生指定学期考勤分数
     * @param klmBatchModel
     * @return
     */
    @Override
    public Long selectAbsentScoreByParam(KlmBatchModel klmBatchModel) {
        return klwStudentAttendanceMapper.selectAbsentScoreByParam(klmBatchModel);
    }
}
